package com.thingsgrid.basicInterface.vo;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.thingsgrid.basicInterface.entity.BasicInterface;
import lombok.Data;

import java.util.List;

@Data
public class TypeChild {
	@JsonSerialize(using = ToStringSerializer.class)
	private Long id;

	private String name ;

	private String url;

	private boolean check = false;


	public TypeChild(BasicInterface basicInterface, List<Long> ids){
		if( !ids.isEmpty() && ids.contains(basicInterface.getApiId())){
			this.check = true;
		}
		this.url = basicInterface.getBaseUrl();
		this.id = basicInterface.getApiId();
		this.name = basicInterface.getApiName();
	}


	public TypeChild(BasicInterface basicInterface){
		this.url = basicInterface.getBaseUrl();
		this.id = basicInterface.getApiId();
		this.name = basicInterface.getApiName();
	}

}
